//
//  NetworkTool+status.swift
//  新浪微博练习
//
//  Created by 韩旭 on 16/11/28.
//  Copyright © 2016年 韩旭. All rights reserved.
//

import Foundation
//extension NetworkTool {
//    func requestStatus(since_id: String, max_id: String, access_token: String, callBack: @escaping (Any?)->()) {
//        let urlStr = "https://api.weibo.com/2/statuses/public_timeline.json"
//        let parameters = ["since_id": since_id,
//                          "max_id": max_id,
//                          "access_token": access_token]
//        
//               NetworkTool.shared.request(url: urlStr, parameters: parameters, method: "GET", callBack:
//            {(responseObject) in
//                callBack(responseObject)
//        })
//    }
//}
extension NetworkTool {
    
    /// 获取微博数据
    ///
    /// - Parameters:
    ///   - since_id: 获取比当前id更新的微博(上下拉刷新)
    ///   - max_id: <#max_id description#>
    ///   - access_token: <#access_token description#>
    ///   - callBack: <#callBack description#>
    func requestStatus (since_id: String, max_id: String, access_token: String?, callBack: @escaping (Any?)->()) {
        guard let access_token = access_token else{
           return 
        }
        let urlStr = "https://api.weibo.com/2/statuses/home_timeline.json"
        let method = "GET"
        let parameters = ["since_id": since_id,
                          "max_id": max_id,
                          "access_token": access_token]
        // 调用AFN 发起网络请求
        NetworkTool.shared.request(url: urlStr, parameters: parameters, method: method, callBack: { (responseObject) in
            callBack(responseObject)
        })
    }
}


















